#!/bin/bash
PLUGIN=monitor_website
TARGET=${PLUGIN}.tar.gz

if [ $# -ne 1 ];then
	echo "use ./make_fabu.sh open|cloud"
	exit 1
fi

COMM_FILE="auto_install.sh auto_uninstall.sh restart.sh start.sh stop.sh dmt_json2.js dmt_xrkmonitor.js monitor_website.js dmt_json2_min.js _apache_monitor_website.conf"

rm -f $TARGET > /dev/null 2>&1

if [ "$1" == "open" ]; then
	tar -czf ${TARGET} $COMM_FILE
    dest_p=open_packet
elif [ "$1" == "cloud" ]; then
	tar -czf ${TARGET} $COMM_FILE
    dest_p=packet
else
	echo "use ./make_fabu.sh open|cloud"
    exit 2
fi

if [ -d /srv/www/monitor/download/${dest_p}/linux ]; then
    echo "cp ${TARGET} /srv/www/monitor/download/${dest_p}/linux"
    cp ${TARGET} /srv/www/monitor/download/${dest_p}/linux
elif [ -d /home/monitor_cms/public/monitor/download/${dest_p}/linux ]; then
    echo "cp ${TARGET} /home/monitor_cms/public/monitor/download/${dest_p}/linux"
    cp ${TARGET} /home/monitor_cms/public/monitor/download/${dest_p}/linux
fi

